import { SET_PERMISSION_LIST, SET_USER_LIST_DATA, SET_TARGET_KEYS } from "./action_types";

const defaultState = {
  permissionList: [],
  userList: [],
  mockData: [],
  targetKeys: []
};

export default (state = defaultState, action) => {
  const { type, list, targetKeys, mockData } = action;
  switch (type) {
    case SET_PERMISSION_LIST:
      return { ...state, permissionList: list };
    case SET_USER_LIST_DATA:
      return { ...state, userList: list, mockData, targetKeys };
    case SET_TARGET_KEYS:
      return {...state, targetKeys};
    default:
      return state;
  }
};
